<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.mongodb.client.MongoCursor,org.bson.Document" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>课程班列表</title>
</head>
<body>
 	<%MongoCursor<Document> courseclasslist = (MongoCursor<Document>)request.getAttribute("result"); %>
	<jsp:include page="navbar.jsp" />
	<div class="container-fluid">
		<div class="row mt15">
			<%if(!courseclasslist.hasNext()) {%>
				<div class="col-md-6 col-md-offset-3">
					<div class="panel panel-default">
	                	<div class="panel-body">	                		
							<h5 class="text-center text-muted">暂无排课信息</h5>
						</div>
					</div>
				</div>
			<%} else {%>
				<div class="col-md-12">
					<div class="panel">
	                	<div class="panel-body">
	                  		<h4 class="page-header mt0">我的课程班信息列表</h4>
	                  		<table class="table table-hover table-bordered text-center">
						    	<tr class="text-center">
						      		<th width="3%">序号</th>
									<th width="9%">课程班代码</th>
									<th width="10%">课程班名称</th>
									<th width="10%">教学班</th>
									<th width="5%">人数</th>
									<th width="5%">考核方式</th>
									<th width="5%">起止周</th>
									<th width="5%">学时</th>
									<th width="5%">总学时</th>
									<th width="5%">周学时</th>
									<th width="5%">学分</th>
									<th width="5%">理论课时</th>
									<th width="5%">实验课时</th>
									<th width="10%">学年</th>
									<th width="3%">学期</th>
									<th width="5%">操作</th>
						    	</tr>
						    	<% 
									int index = 0;
									while(courseclasslist.hasNext()) {
										Document document = courseclasslist.next();%>
										<tr>
								    	    <td><%=++index %></td>
								    		<td><%=document.getString("coursecode") %></td>
								    		<td><%=document.getString("name") %></td>
								    		<td><%=document.getString("class") %></td>
								    		<td><%=document.getString("number") %></td>
								    		<td><%=document.getString("testtype") %></td>
								    		<td><%=document.getString("beginendweek") %></td>
								    		<td><%=document.getString("studytime") %></td>
								    		<td><%=document.getString("allstudytime") %></td>
								    		<td><%=document.getString("weekstudytime") %></td>
								    		<td><%=document.getString("credit") %></td>
								    		<td><%=document.getString("theortytime") %></td>
								    		<td><%=document.getString("labtime") %></td>
								    		<td><%=document.getString("year") %></td>
								    		<td><%=document.getString("semester") %></td>
								    		<td>
										<a href="courseclassServlet?_id=<%=document.getObjectId("_id") %>&method=delete">
											<button type="button" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="删除" ><em class="fa fa-trash"></em></button>
										</a>
								    		</td>
								    	</tr>	
								<% } %>
							</table>
	                  	</div>
	                </div>     
            	</div>
             <%} %>
         </div>
	</div>
	<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
	<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<script>
		$(function () { $("[data-toggle='tooltip']").tooltip(); });
	</script>
</body>
</html>